/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package GUIv2;

import javax.swing.UIManager;

import org.apache.log4j.Logger;

import com.jgoodies.looks.plastic.Plastic3DLookAndFeel;

public class MainWindow extends javax.swing.JFrame {
    private static final long serialVersionUID = -5325424039593596978L;
    private static Logger log = Logger.getLogger(MainWindow.class);

    public MainWindow() {
        initComponents();
    }

    private void initComponents() {

        tabbedPanel = new javax.swing.JTabbedPane();
        monitoredFoldersMainPanel = new javax.swing.JPanel();
        monitoredFolderReplacePanel1 = new GUIv2.MonitoredFolderReplacePanel();
        versioningMainPanel = new javax.swing.JPanel();
        versioningReplacePanel1 = new GUIv2.VersioningReplacePanel();
        fileAttributesMainPanel = new javax.swing.JPanel();
        fileAttributeReplacePanel1 = new GUIv2.FileAttributeReplacePanel();
        manuBar = new javax.swing.JMenuBar();
        mainMenu = new javax.swing.JMenu();
        propertiesMenuItem = new javax.swing.JMenuItem();
        exitMenuItem = new javax.swing.JMenuItem();
        aboutMenu = new javax.swing.JMenu();
        authorMenuItem = new javax.swing.JMenuItem();

        setDefaultCloseOperation(javax.swing.WindowConstants.HIDE_ON_CLOSE);

        javax.swing.GroupLayout monitoredFoldersMainPanelLayout = new javax.swing.GroupLayout(monitoredFoldersMainPanel);
        monitoredFoldersMainPanel.setLayout(monitoredFoldersMainPanelLayout);
        monitoredFoldersMainPanelLayout.setHorizontalGroup(
                monitoredFoldersMainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(monitoredFolderReplacePanel1, javax.swing.GroupLayout.DEFAULT_SIZE, 420, Short.MAX_VALUE)
        );
        monitoredFoldersMainPanelLayout.setVerticalGroup(
                monitoredFoldersMainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(monitoredFolderReplacePanel1, javax.swing.GroupLayout.DEFAULT_SIZE, 303, Short.MAX_VALUE)
        );

        tabbedPanel.addTab("Monitored folders", monitoredFoldersMainPanel);

        javax.swing.GroupLayout versioningMainPanelLayout = new javax.swing.GroupLayout(versioningMainPanel);
        versioningMainPanel.setLayout(versioningMainPanelLayout);
        versioningMainPanelLayout.setHorizontalGroup(
                versioningMainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(versioningReplacePanel1, javax.swing.GroupLayout.DEFAULT_SIZE, 420, Short.MAX_VALUE)
        );
        versioningMainPanelLayout.setVerticalGroup(
                versioningMainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, versioningMainPanelLayout.createSequentialGroup()
                                .addGap(0, 0, Short.MAX_VALUE)
                                .addComponent(versioningReplacePanel1, javax.swing.GroupLayout.PREFERRED_SIZE, 307, javax.swing.GroupLayout.PREFERRED_SIZE))
        );

        tabbedPanel.addTab("Versioning", versioningMainPanel);

        javax.swing.GroupLayout fileAttributesMainPanelLayout = new javax.swing.GroupLayout(fileAttributesMainPanel);
        fileAttributesMainPanel.setLayout(fileAttributesMainPanelLayout);
        fileAttributesMainPanelLayout.setHorizontalGroup(
                fileAttributesMainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(fileAttributeReplacePanel1, javax.swing.GroupLayout.DEFAULT_SIZE, 420, Short.MAX_VALUE)
        );
        fileAttributesMainPanelLayout.setVerticalGroup(
                fileAttributesMainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, fileAttributesMainPanelLayout.createSequentialGroup()
                                .addGap(0, 0, Short.MAX_VALUE)
                                .addComponent(fileAttributeReplacePanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
        );

        tabbedPanel.addTab("File attributes", fileAttributesMainPanel);

        mainMenu.setText("Menu");

        propertiesMenuItem.setText("Properties");
        propertiesMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                propertiesMenuItemActionPerformed(evt);
            }
        });
        mainMenu.add(propertiesMenuItem);

        exitMenuItem.setText("Hide...");
        exitMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                hideItemActionPerformed(evt);
            }
        });
        mainMenu.add(exitMenuItem);

        manuBar.add(mainMenu);

        aboutMenu.setText("About");

        authorMenuItem.setText("Author");
        authorMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                aboutMenuItemActionPerformed(evt);
            }
        });
        
        aboutMenu.add(authorMenuItem);

        manuBar.add(aboutMenu);

        setJMenuBar(manuBar);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(tabbedPanel)
        );
        layout.setVerticalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(tabbedPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 331, javax.swing.GroupLayout.PREFERRED_SIZE)
        );

        pack();
    }

    private void propertiesMenuItemActionPerformed(java.awt.event.ActionEvent evt) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new GUI.GlobalPropertiesGUI().setVisible(true);
            }
        });
    }
    
    private void hideItemActionPerformed(java.awt.event.ActionEvent evt) {
        this.setVisible(false);
    }
    
    private void aboutMenuItemActionPerformed(java.awt.event.ActionEvent evt) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new About().setVisible(true);
            }
        });
    }
    

    public static void main(String args[]) {
        try {
            UIManager
                    .setLookAndFeel(new Plastic3DLookAndFeel());
        } catch (Exception e) {
            log.error(e.getMessage());
        }
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new MainWindow().setVisible(true);
            }
        });
    }

    private javax.swing.JMenu aboutMenu;
    private javax.swing.JMenuItem authorMenuItem;
    private javax.swing.JMenuItem exitMenuItem;
    private GUIv2.FileAttributeReplacePanel fileAttributeReplacePanel1;
    private javax.swing.JPanel fileAttributesMainPanel;
    private javax.swing.JMenu mainMenu;
    private javax.swing.JMenuBar manuBar;
    private GUIv2.MonitoredFolderReplacePanel monitoredFolderReplacePanel1;
    private javax.swing.JPanel monitoredFoldersMainPanel;
    private javax.swing.JMenuItem propertiesMenuItem;
    private javax.swing.JTabbedPane tabbedPanel;
    private javax.swing.JPanel versioningMainPanel;
    private GUIv2.VersioningReplacePanel versioningReplacePanel1;
}
